////////////////////////////////////////////////////////////////////////////
//
//  Crytek Engine Source File.
//  Copyright (C), Crytek Studios, 2001-2010.
// -------------------------------------------------------------------------
//  File name:   ThreadInfo.h
//  Version:     v1.00
//  Created:     23/6/2012 by Paul Reindell.
//  Description: 
// -------------------------------------------------------------------------
//  History:
//
////////////////////////////////////////////////////////////////////////////
#ifndef __ThreadInfo_H__
#define __ThreadInfo_H__

#if defined(ENABLE_PROFILING_CODE)

struct SThreadInfo
{
public:
	struct SThreadHandle
	{
		HANDLE Handle;
		uint32 Id;
	};

	typedef std::vector<uint32> TThreadIds;
	typedef std::vector<SThreadHandle> TThreads;
	typedef std::map<uint32, string> TThreadInfo;

	// returns thread info
	static void GetCurrentThreads(TThreadInfo& threadsOut);

	// fills threadsOut vector with thread handles of given thread ids; if threadIds vector is emtpy it fills all running threads
	// if ignoreCurrThread is true it will not return the current thread
	static void OpenThreadHandles(TThreads& threadsOut, const TThreadIds& threadIds = TThreadIds(), bool ignoreCurrThread = true);

	// closes thread handles; should be called whenever GetCurrentThreads was called!
	static void CloseThreadHandles(const TThreads& threads);
};

#endif //#if defined(ENABLE_PROFILING_CODE)

#endif //#ifndef __ThreadInfo_H__